<div class="container">
	<div class="row">
		<div class="span12">
		<?php if(!empty($this->message)):?>
		<div class="alert alert-info">
		<button class="close" data-dismiss="alert" type="button">×</button>
		<?php 	echo $this->translate($this->message); ?>
		</div>
		<?php endif;?>
		<?php if($this->offers != null){ ?>
		<table class="table table-bordered">
			<thead><tr><td><input type="checkbox" value=""></td><td colspan="3"><a class="btn btn-danger" href="#"><i class="icon-trash icon-white"></i> <?php echo $this->translate('Delete');?></a></td></tr></thead>
		<?php foreach ($this->offers as $offer){ 
			$object = $offer->object;
			$images = $object->images;
			$objecturl = 'view/'.strtolower($offer->classe).'/'.$offer->id_classe.'-'.Application_Model_Tool_ObjectUrl::getObjectNameUrl($object->name);
			$editobjecturl = 'object/'.strtolower($offer->classe).'/'.$offer->id_classe.'-'.Application_Model_Tool_ObjectUrl::getObjectNameUrl($object->name);
			$objectdelurl = 'delete/'.strtolower($offer->classe).'/'.$offer->id_classe.'-'.Application_Model_Tool_ObjectUrl::getObjectNameUrl($object->name).'/'.$this->token->delete;
			$offerdelurl = 'delete/offer/'.$offer->offerId.'/'.$this->token->delete;
		?>
			
			<tr>
			<td style="width: 10px;">
				<input type="checkbox" value="">
			</td>
			<td style="width: 64px;">
				<a href="#" class="popright" rel="popover" data-content="<?php echo $object->description; ?>" data-original-title="Description">
				<img style="width: 64px; height: 64px;" src="<?php echo $this->baseUrl('img/object/'.$images[0]->url);?>" class="img-rounded" />
				</a>
			</td>
			<td>
				<a class="close" type="button" title="<?php echo $this->translate('Delete').' '.$object->name; ?>" href="<?php echo $this->baseUrl($objectdelurl); ?>">×</a>
				<a href="<?php echo $this->baseUrl($objecturl); ?>"><?php echo $object->name; ?></a>
				<br>
				<small><?php echo $this->translate($offer->classe); ?></small>
				<div class="btn-group">
					<a class="btn btn-success" href="<?php echo $this->baseUrl($editobjecturl); ?>"><i class="icon-pencil icon-white"></i> <?php echo $this->translate('Edit'); ?></a>
				</div>
				
			</td>
			<td>
				<?php if($offer->price != null){ ?>
				<a class="close" type="button" title="<?php echo $this->translate('Delete this offer'); ?>" href="<?php echo $this->baseUrl($offerdelurl); ?>">×</a>
				<strong><?php echo $offer->price.' '.$offer->price_currency; ?></strong>
				<br><small><?php $time =  $this->timeSince(strtotime($offer->start_date));
	    						echo $this->translate('%1$s %2$s ago', $time['nb'] ,$time['text']); ?></small><br>
				<?php $address = $offer->addresses;
				$address = $address[0];
				echo $address->zipCode;?>
				
				<?php }else{ ?>
				 <div class="btn-group">
				    <a class="btn btn-primary" href="<?php echo $this->baseUrl($objecturl); ?>">€ <?php echo $this->translate('Offer'); ?></a>
				 </div>
				 
				<?php } ?>
			</td>
			</tr>
			
		<?php } ?>
			</tbody>
		</table>
		<?php } ?>
		</div>
	</div>
</div>